home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / questTroubleTheEndb.lua < prev    next >
Text File  |  2004-01-29  |  2KB  |  67 lines

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questTroubleTheEndb entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- debug mechanism, should be implemented properly such that a reset by questormessage is possible 
  10.     -- make sure that the initial condition wont be triggerd right away, maybe reset all prerequesites in order to prevent that
  11.     onMsg("questreset", function(msg)
  12.         getParent().getParent().getCharacter(MIKE).decRelationshipCondition(ELAINE, REL_TROUBLE,1);
  13.         getParent().getParent().getCharacter(ELAINE).decRelationshipCondition(MIKE, REL_TROUBLE,1);
  14.         setState("initial");
  15.     end ) 
  16. ---------------------------------------------------------------------------------------------------------------------------------------    
  17.     
  18.     state("initial") 
  19.         onMsg("checkCondition", function(msg)
  20.             local mike = getParent().getParent().getCharacter(MIKE);
  21.             local elaine = getParent().getParent().getCharacter(ELAINE);
  22.  
  23.             if ( mike.getRelationshipCondition(ELAINE, REL_TROUBLE) >= 10 )
  24.             then
  25.                 -- go to talk position
  26.                 --elaine.cancelAllActivities();
  27.                 --mike.cancelAllActivities();
  28.                 
  29.                 mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questTroubleTheEndb");
  30.                 setState("talktome");
  31.             end
  32.         end )
  33.         
  34.         
  35.     state("talktome")
  36.         -- assoon as arrived - start dialog
  37.         ----------------
  38.         onMsg("talking", function(msg)
  39.             if (msg.data == "questTroubleTheEndb") then
  40.                 popupConversation("dialogTroubleTheEndb");
  41.                 setState("donetalktome");
  42.             end
  43.         ----------------
  44.         end )
  45.         
  46.     state("donetalktome");
  47.         onMsg("yes", function(msg)
  48.             getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
  49.             getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
  50.             setState("done");
  51.         end )
  52.         
  53. ---------------------------------------------------------------------------------------------------------------------------------------    
  54.  
  55.         
  56.     state("done")
  57.     
  58.     -- sackgasse hier
  59.         
  60.         
  61.         
  62. endStateMachine()
  63.  
  64.  
  65.  
  66.  
  67.